/**
 * @Author ouxueting
 */
package com.chinaunicom.tour.sys.service;

import com.chinaunicom.tour.sys.entity.User;
import com.chinaunicom.tour.sys.mapper.UserMapper;
import com.chinaunicom.tour.sys.model.UserModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class UserService {

    @Autowired
    UserMapper userMapper;

    public User findByUserName(String userName){
        return userMapper.findByUserName(userName);
    }

    public int add(User user){
        user.setCreateTime(new Date());
        return userMapper.add(user);
    }

    public User findByUserNameAndPwd(UserModel user){
        return userMapper.findByUserNameAndPwd(user);
    }
    public User findByUserNameAndEmail (UserModel user){
        return userMapper.findByUserNameAndEmail(user);
    }

    public int update( User entity){
        return userMapper.update(entity);
    }
    public User findById(String id){
        return userMapper.findById(id);
    }

}
